﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ParticleSystem;

namespace BGSpaceShooter
{
    public class Projectile : GameObject
    {
        public IObjectEffect MotionEffect { get; set; }

        public Projectile(Model model)
            : base(model)
        {
            Scale = BGSpaceShooterServer.Server.AsteroidBoundingSphereRadius / BoundingSphere.Radius;
            RotationMatrix = Matrix.Identity;
            MotionEffect = new ProjectileEffect(this);
            MotionEffect.IsActive = false;
        }

        public override IDrawer GetDrawer()
        {
            return new ProjectileDrawer(this);
        }

        public void UpdatePosition(TimeSpan time)
        {
            Position += Convert.ToSingle(time.TotalMilliseconds) * Velocity;
        }

        public override IEnumerable<IObjectEffect> GetEffectsToDraw()
        {
            return new List<IObjectEffect>() { MotionEffect };
        }
    }
}
